package com.game77.guessTheWords2.scene;

import android.view.KeyEvent;

import com.game77.guessTheWords2.layer.ClassChooseLayer;
import com.game77.guessTheWords2.layer.StageLayer;
import com.game77.guessTheWords2.util.GameUtil;
import com.wiyun.engine.nodes.Scene;

public class ClassChooseScene extends Scene {
	private static ClassChooseScene instance = null;
	private static Object sync_obj = new Object();

	ClassChooseLayer classChooseLayer;

	protected ClassChooseScene() {
		classChooseLayer = new ClassChooseLayer();
		classChooseLayer.setTouchEnabled(true);
		addChild(classChooseLayer);
	}

	public static ClassChooseScene make() {
		synchronized (sync_obj) {
			if (instance == null) {
				instance = new ClassChooseScene();
			}
			return instance;
		}
	}

	@Override
	public boolean wyKeyDown(KeyEvent event) {
		if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
			GameUtil.switchSceneNormalFast(MainScene.make());
			return true;
		}
		return super.wyKeyDown(event);
	}

	public void refreshClassInfos() {
		classChooseLayer.refreshClassInfos();

	}

	public void updateCoins() {
		classChooseLayer.updateCoinCount();
	}
}
